#include <iostream>
#include <unordered_set>
#include <vector>
#include <queue>
#include <string>
#include <cmath>
#include <algorithm>
#include <unordered_map>
using namespace std;

class Solution3 {
public:
    int ladderLength(string beginWord, string endWord, vector<string>& wordList) {
        unordered_set<string> hash(wordList.begin(), wordList.end());
        unordered_set<string> vis;
        if (hash.count(endWord) == 0)
            return 0;

        queue<string> q;
        q.push(beginWord);
        vis.insert(beginWord);
        int ret = 1;
        while (q.size())
        {
            ++ret;
            int sz = q.size();
            while (sz--)
            {
                string t = q.front();
                q.pop();
                for (int i = 0; i < t.size(); ++i)
                {
                    string tmp = t;
                    for (char ch = 'a'; ch <= 'z'; ++ch)
                    {
                        tmp[i] = ch;
                        if (hash.count(tmp) && !vis.count(tmp))
                        {
                            if (tmp == endWord)
                                return ret;
                            q.push(tmp);
                            vis.insert(tmp);
                        }
                    }
                }
            }
        }
        return 0;
    }
};

int main()
{
    string str;
    int n;
    cin >> str >> n;
    if (n > str.size())
    {
        cout << str << endl;
        return 0;
    }

    unordered_map<char, int> hash;
    for (int i = 0; i < n; ++i)
        if (str[i] == 'C' || str[i] == 'G')
            ++hash[str[i]];
    double GCRatio1 = (double)(hash['C'] + hash['G']) / n;

    string ret = str.substr(0, n);
    for (int left = 0, right = n; right < str.size(); ++right)
    {
        if (str[right] == 'C' || str[right] == 'G')
            ++hash[str[right]];
        if (str[left] == 'C' || str[left] == 'G')
            --hash[str[left]];
        ++left;
        double GCRatio2 = (double)(hash['C'] + hash['G']) / n;
        if (GCRatio2 > GCRatio1)
        {
            GCRatio1 = GCRatio2;
            ret = str.substr(left, right - left + 1);
        }
    }

    cout << ret << endl;

    return 0;
}

bool isPrime(int n)
{
    for (int i = 2; i <= (int)sqrt(n); ++i)
    {
        if (n % i == 0)
            return false;
    }
    return true;
}

int main2()
{
    int l, r;
    cin >> l >> r;
    if (r <= 10)
    {
        cout << 0 << endl;
        return 0;
    }
    if (l <= 10)
        l = 11;


    vector<int> nums;
    for (int i = l; i <= r; ++i)
        nums.emplace_back(i);

    int ret = 0;
    for (auto& e : nums)
    {
        int t = e;
        vector<int> tmp;
        while (t)
        {
            tmp.push_back(t % 10);
            t /= 10;
        }
        int flag = 0;
        for (int i = 0; i < tmp.size() - 1; ++i)
        {
            if (tmp[i] == 0)
                continue;
            for (int j = i + 1; j < tmp.size(); ++j)
            {
                if (tmp[j] == 0)
                    continue;
                int a = 0;
                if (tmp[j] % 2 != 0)
                {
                    int a = tmp[i] * 10 + tmp[j];
                    if (isPrime(a))
                    {
                        ++ret;
                        flag = 1;
                        break;
                    }
                }
                if (tmp[i] != tmp[j] && tmp[i] % 2 != 0)
                {
                    a = tmp[j] * 10 + tmp[i];
                    if (isPrime(a))
                    {
                        ++ret;
                        flag = 1;
                        break;
                    }
                }
            }
            if (flag == 1)
                break;
        }
    }
    cout << ret << endl;

    return 0;
}

class Solution2 {
public:
    string formatString(string str, vector<char>& arg)
    {
        string ret;
        int j = 0;
        for (int i = 0; i < str.size(); ++i)
        {
            if (str[i] == '%' && i + 1 < str.size() && str[i + 1] == 's')
            {
                ret += arg[j++];
                ++i;
            }
            else
                ret += str[i];
        }
        while (j < arg.size())
            ret += arg[j++];

        return ret;
    }
};

class Solution1 {
public:
    int minMutation(string startGene, string endGene, vector<string>& bank) {
        unordered_set<string> vis;
        unordered_set<string> hash(bank.begin(), bank.end());
        string change = "ACGT";

        if (!hash.count(endGene))
            return -1;
        if (startGene == endGene)
            return 0;

        queue<string> q;
        q.push(startGene);
        vis.insert(startGene);

        int ret = 0;
        while (q.size())
        {
            ++ret;
            int sz = q.size();
            while (sz--)
            {
                string t = q.front();
                q.pop();
                for (int i = 0; i < 8; ++i)
                {
                    string tmp = t;
                    for (int j = 0; j < 4; ++j)
                    {
                        tmp[i] = change[j];
                        if (hash.count(tmp) && !vis.count(tmp))
                        {
                            if (tmp == endGene)
                                return ret;
                            q.push(tmp);
                            vis.insert(tmp);
                        }
                    }
                }
            }
        }
        return -1;
    }
};

int main1()
{
    Solution1();
    Solution2();
    return 0;
}